#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 8010;
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int a[maxn]={0};
		int ma[maxn]={0};
		int n;
		scanf("%d",&n);
		for(int i = 1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			ma[a[i]]++;
			a[i] += a[i-1];
		//	printf("%d ",a[i]);
		}
		//cout<<endl;
		int ans = 0;
		for(int i = 1;i<=n;i++)
		for(int j = i+1;j<=n;j++)
		{
			int sum = a[j]-a[i-1];
			if(sum<=8000&&ma[sum])
			{
				ans += ma[sum];
				ma[sum] = 0;
			}
		}
		printf("%d\n",ans);
	}
}
